<?php

namespace JLPay\Models\Openmerch\Query;

/**
 * 实名认证信息
 */
class RealNameInfo
{
    protected string $applymentStatus = '';  // 申请状态，1-审核中，2-待确认联系信息，3-待账户验证，4-审核通过，5-审核驳回，6-已冻结，7-已作废（query_type=0时返回）
    protected string $qrcodeData = '';  // 二维码链接地址，二维码url地址（微信二维码有效期30分钟）
    protected string $rejectParam = '';  // 驳回字段，驳回的字段名
    protected string $rejectReason = '';  // 审核驳回原因，实名认证驳回原因
    protected string $authorizeState = '';  // 授权状态，200-已授权，201-未授权（query_type=1时返回）

    /**
     * 构造函数
     *
     * @param array $data
     */
    public function __construct(array $data = [])
    {
        $this->applymentStatus = $data['applyment_status'] ?? '';
        $this->qrcodeData = $data['qrcode_data'] ?? '';
        $this->rejectParam = $data['reject_param'] ?? '';
        $this->rejectReason = $data['reject_reason'] ?? '';
        $this->authorizeState = $data['authorize_state'] ?? '';
    }

    /**
     * 获取申请状态
     *
     * @return string
     */
    public function getApplymentStatus(): string
    {
        return $this->applymentStatus;
    }

    /**
     * 获取二维码链接地址
     *
     * @return string
     */
    public function getQrcodeData(): string
    {
        return $this->qrcodeData;
    }

    /**
     * 获取驳回字段
     *
     * @return string
     */
    public function getRejectParam(): string
    {
        return $this->rejectParam;
    }

    /**
     * 获取审核驳回原因
     *
     * @return string
     */
    public function getRejectReason(): string
    {
        return $this->rejectReason;
    }

    /**
     * 获取授权状态
     *
     * @return string
     */
    public function getAuthorizeState(): string
    {
        return $this->authorizeState;
    }

    /**
     * 转换为数组
     *
     * @return array
     */
    public function toArray(): array
    {
        return [
            'applyment_status' => $this->applymentStatus,
            'qrcode_data' => $this->qrcodeData,
            'reject_param' => $this->rejectParam,
            'reject_reason' => $this->rejectReason,
            'authorize_state' => $this->authorizeState,
        ];
    }
} 